<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <!-- 引入 css -->
  <link href="./server1/wangeditor/dist/css/style.css" rel="stylesheet">
  <!-- 引入 js -->
  <script src="./server1/wangeditor/dist/index.min.js"></script>
</head>
<body>
<div class="z-wang-editor">
  <!--    {{value}}-->
  <div id="toolbarID"></div>
  <div id="editorID"></div>
</div>
<script type="module">
  import * as Lib from './server1/message.js'
  Lib.onMessage(function (name, value) {
    if (name === Lib.READY_FLAG) {
      console.log('初始化成功', value)
    } else {
      console.log('iframe', name, value)
    }
  })

  document.addEventListener('DOMContentLoaded', function () {
    const {createEditor, createToolbar } = window.wangEditor
    // console.log(createEditor)

    const editorID = 'editorID'
    const editorConfig  = {}

    // console.log(document.querySelector('#editorID'))

    const toolbarID = 'toolbarID'
    const toolbarConfig  = {}

    let editor = createEditor({
      selector: "#" + editorID,
      config: editorConfig,
      content: '', // 默认内容，下文有解释
      // mode: 'simple' // 或者 'simple' ，下文有解释
    });


    let toolbar = createToolbar({
      editor,
      selector: '#' + toolbarID,
      // config: toolbarConfig,
      // mode: 'simple' // 或者 'simple' ，下文有解释
    })

  })
</script>
</body>
</html>
